﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ListadoRegistradosExamen.aspx.cs"
    Inherits="Ent.Inscripcion.Presentacion.Administracion.Reportes.ListadoRegistradosExamen" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Listado de Registrados para rendir Examen</title>
    <ext:ResourcePlaceHolder ID="ResourcePlaceHolder1" runat="server" Mode="Script" />
    <script type="text/javascript" src="../../Resources/Js/EntInscripcion.js"></script>
</head>
<body>
    <form runat="server">
    <ext:ResourceManager ID="ResourceManager1" runat="server" Locale="es" />
    <script type="text/javascript" language="javascript">
    var saveData = function () {
            <%= GridData.ClientID%>.setValue(Ext.encode(<%= gdpRegistrados.ClientID%>.getRowsValues(false)));
        }
    </script>
    <ext:Hidden ID="GridData" runat="server" />
    <ext:Viewport ID="ViewPort1" runat="server" Layout="Fit">
        <LayoutConfig>
            <ext:VBoxLayoutConfig Align="Stretch" />
        </LayoutConfig>
        <Items>
            <ext:Panel ID="Panel2" BodyStyle="background-color:transparent;" Padding="10" Border="false"
                runat="server" ButtonAlign="Center">
                <Items>
                    <ext:FormPanel ID="frpDatosBusqueda" BodyStyle="background-color:transparent;" runat="server"
                        Border="false" Layout="Column" LabelWidth="70" ButtonAlign="Center">
                        <Items>
                            <ext:Panel ID="Panel3" runat="server" ColumnWidth="0.5" Height="50" Border="false"
                                Layout="Form">
                                <Items>
                                    <ext:DateField runat="server" ID="dtfFecha" FieldLabel="Fecha" AnchorHorizontal="95%"
                                        AllowBlank="false" ShowToday="true" />
                                    <ext:TextField ID="txtCedula" runat="server" FieldLabel="Cédula" AnchorHorizontal="95%" />
                                </Items>
                            </ext:Panel>
                            <ext:Panel ID="Panel6" runat="server" ColumnWidth="0.5" Border="false" Layout="Form">
                                <Items>
                                    <ext:TimeField ID="tfHoraInicio" AllowBlank="false" FieldLabel="Hora Inicio" runat="server"
                                        MinTime="7:00" MaxTime="21:00" Increment="15" Format="H:mm">
                                        <ToolTips>
                                            <ext:ToolTip ID="ToolTip1" runat="server" Title="Hora de inicio del exámen">
                                            </ext:ToolTip>
                                        </ToolTips>
                                    </ext:TimeField>
                                </Items>
                            </ext:Panel>
                        </Items>
                        <Buttons>
                            <ext:Button ID="btnListar" runat="server" Text="Listar" Icon="Table">
                                <DirectEvents>
                                    <Click Before="return ValidarFormulario(#{frpDatosBusqueda});" OnEvent="btnListar_Click">
                                        <ExtraParams>
                                            <ext:Parameter Name="Fecha" Value="#{dtfFecha}.getValue()" Mode="Raw" />
                                            <ext:Parameter Name="Hora" Value="#{tfHoraInicio}.getValue()" Mode="Raw" />
                                            <ext:Parameter Name="Cedula" Value="#{txtCedula}.getValue()" Mode="Raw" />
                                        </ExtraParams>
                                        <EventMask Msg="Buscando Registrados" ShowMask="true" />
                                    </Click>
                                </DirectEvents>
                            </ext:Button>
                        </Buttons>
                    </ext:FormPanel>
                </Items>
            </ext:Panel>
            <ext:GridPanel ID="gdpRegistrados" runat="server" StripeRows="true" AutoWidth="true"
                Height="600" AutoExpandColumn="Observacion">
                <Store>
                    <ext:Store runat="server" ID="stoRegistrados">
                        <Reader>
                            <ext:JsonReader IDProperty="IdSolicitudHorario">
                                <Fields>
                                    <ext:RecordField Name="IdSolicitudHorario" />
                                    <ext:RecordField Name="Nombre" />
                                    <ext:RecordField Name="Apellidos" />
                                    <ext:RecordField Name="Identificacion" />
                                    <ext:RecordField Name="Email" />
                                    <ext:RecordField Name="Direccion" />
                                    <ext:RecordField Name="Celular" />
                                    <ext:RecordField Name="Telefono" />
                                    <ext:RecordField Name="Imagen" />
                                    <ext:RecordField Name="Carrera" />
                                    <ext:RecordField Name="Estado" />
                                    <ext:RecordField Name="Observacion" />
                                    <ext:RecordField Name="Fecha" Type="Date" />
                                    <ext:RecordField Name="Hora" Type="Date" />
                                    <ext:RecordField Name="Nivel" />
                                </Fields>
                            </ext:JsonReader>
                        </Reader>
                    </ext:Store>
                </Store>
                <TopBar>
                    <ext:Toolbar ID="Toolbar3" runat="server">
                        <Items>
                            <ext:Button ID="btnExcel" runat="server" Text="Exportar a Excel" AutoPostBack="true"
                                OnClick="ToExcel" Icon="PageExcel">
                                <Listeners>
                                    <Click Fn="saveData" />
                                </Listeners>
                            </ext:Button>
                        </Items>
                    </ext:Toolbar>
                </TopBar>
                <ColumnModel ID="ColumnModel3" runat="server">
                    <Columns>
                        <ext:TemplateColumn DataIndex="Imagen" Header="Foto">
                            <Template runat="server">
                                <Html>
                                    <img style="width: 60px; height: 45px;" src="../Images/{Imagen}" />
                                </Html>
                            </Template>
                        </ext:TemplateColumn>
                        <ext:Column Header="Identificacion" Width="90" Sortable="true" DataIndex="Identificacion" />
                        <ext:Column Header="Nombre" Width="150" Sortable="true" DataIndex="Nombre" />
                        <ext:Column Header="Apellidos" Width="150" Sortable="true" DataIndex="Apellidos" />
                        <ext:Column Header="Carrera" Width="100" Sortable="true" DataIndex="Carrera" />
                        <ext:Column Header="Nivel" Width="150" Sortable="true" DataIndex="Nivel" />
                        <ext:DateColumn Header="Fecha" Width="150" Sortable="true" DataIndex="Fecha" Format="j \de F \de\l Y" />
                        <ext:DateColumn Header="Hora" Width="100" Sortable="true" DataIndex="Hora" Format="H:mm">
                        </ext:DateColumn>
                        <ext:Column Header="Email" Width="100" Sortable="true" DataIndex="Email" />
                        <ext:Column Header="Celular" Width="70" Sortable="true" DataIndex="Celular" />
                        <ext:Column Header="Telefono" Width="70" Sortable="true" DataIndex="Telefono" />
                        <ext:Column Header="Estado" Width="70" Sortable="true" DataIndex="Estado">
                        </ext:Column>
                        <ext:Column ColumnID="Observacion" Header="Observación" Width="100" Sortable="true"
                            DataIndex="Observacion" />
                    </Columns>
                </ColumnModel>
                <SelectionModel>
                    <ext:RowSelectionModel ID="RowSelectionModel3" runat="server" SingleSelect="true">
                    </ext:RowSelectionModel>
                </SelectionModel>
                <Plugins>
                    <ext:RowExpander ID="RowExpander" runat="server">
                        <Component>
                            <ext:FormPanel ID="RowEditor1" Width="800" runat="server" Padding="3" Height="250"
                                Border="false" Layout="Column" ForceLayout="true" ButtonAlign="Right" Cls="white-footer">
                                <Items>
                                    <ext:Panel ID="Panel1" runat="server" Border="false" Header="false" ColumnWidth=".5"
                                        Layout="Form" ButtonAlign="Left" Height="210">
                                        <Items>
                                            <ext:Image runat="server" ID="imgEstudiante" Width="150" Height="150" ImageUrl="../Images/noDisponible.jpg">
                                            </ext:Image>
                                            <ext:FileUploadField HideLabel="true" ID="fufImagenEstudiante" runat="server" EmptyText="Seleccione foto"
                                                ButtonText="Seleccione foto estudiante" Icon="ImageAdd" AnchorHorizontal="90%">
                                                <DirectEvents>
                                                    <FileSelected OnEvent="btnGuardarImagen_Click" Failure="ManejarError();">
                                                        <ExtraParams>
                                                            <ext:Parameter Name="Identificacion" Value="#{txtIdentificacion}.getValue()" Mode="Raw">
                                                            </ext:Parameter>
                                                        </ExtraParams>
                                                    </FileSelected>
                                                </DirectEvents>
                                            </ext:FileUploadField>
                                            <ext:Hidden runat="server" ID="hidImagen" DataIndex="Imagen">
                                            </ext:Hidden>
                                        </Items>
                                    </ext:Panel>
                                    <ext:Panel ID="Panel4" runat="server" Border="false" Layout="Form" ColumnWidth=".5">
                                        <Items>
                                            <ext:Hidden runat="server" ID="hidId" DataIndex="IdSolicitudHorario" />
                                            <ext:Hidden runat="server" ID="hidEstado" DataIndex="Estado" />
                                            <ext:Hidden runat="server" ID="hidNivel" DataIndex="Nivel" />
                                            <ext:Hidden runat="server" ID="hidHora" DataIndex="Hora" />
                                            <ext:TextField ID="txtIdentificacion" runat="server" DataIndex="Identificacion" FieldLabel="Identificación"
                                                AnchorHorizontal="90%" ReadOnly="true" />
                                            <ext:TextField ID="txtNombre" runat="server" DataIndex="Nombre" FieldLabel="Nombre"
                                                AnchorHorizontal="90%" ReadOnly="true" />
                                            <ext:TextField ID="txtApellido" runat="server" DataIndex="Apellidos" FieldLabel="Apellido"
                                                AnchorHorizontal="90%" ReadOnly="true" />
                                            <ext:RadioGroup ID="radOpcion" runat="server" ItemCls="x-check-group-base" FieldLabel="">
                                                <Items>
                                                    <ext:Radio ID="radSiPresento" runat="server" BoxLabel="Se presento" Checked="true" />
                                                    <ext:Radio ID="radNoPresento" runat="server" BoxLabel="No se presento" />
                                                </Items>
                                            </ext:RadioGroup>
                                            <ext:TextArea runat="server" ID="txaObservacion" FieldLabel="Observación" DataIndex="Observacion"
                                                AnchorHorizontal="90%" />
                                        </Items>
                                    </ext:Panel>
                                </Items>
                                <Buttons>
                                    <ext:Button ID="btnGuardar" runat="server" Text="Guardar" Icon="Disk">
                                        <Listeners>
                                            <Click Handler="#{RowEditor1}.getForm().updateRecord(#{RowEditor1}.record);
                                                        #{RowExpander}.collapseRow(#{stoRegistrados}.indexOf(#{RowEditor1}.record));" />
                                        </Listeners>
                                        <DirectEvents>
                                            <Click OnEvent="btnGuardar_Click" Failure="ManejarError();">
                                                <ExtraParams>
                                                    <ext:Parameter Name="Id" Value="#{hidId}.getValue()" Mode="Raw"/>
                                                    <ext:Parameter Name="Identificacion" Value="#{txtIdentificacion}.getValue()" Mode="Raw"/>
                                                    <ext:Parameter Name="Observacion" Value="#{txaObservacion}.getValue()" Mode="Raw"/>
                                                    <ext:Parameter Name="SiPresento" Value="#{radSiPresento}.getValue()" Mode="Raw"/>
                                                    <ext:Parameter Name="NoPresento" Value="#{radNoPresento}.getValue()" Mode="Raw"/>
                                                    <ext:Parameter Name="HoraInicio" Value="#{hidHora}.getValue()" Mode="Raw"/>
                                                    <ext:Parameter Name="Nivel" Value="#{hidNivel}.getValue()" Mode="Raw"/>
                                                </ExtraParams>
                                            </Click>
                                        </DirectEvents>
                                    </ext:Button>
                                    <ext:Button ID="Button2" runat="server" Text="Cancel" Icon="Decline">
                                        <Listeners>
                                            <Click Handler="#{RowExpander}.collapseRow(#{stoRegistrados}.indexOf(#{RowEditor1}.record));" />
                                        </Listeners>
                                    </ext:Button>
                                </Buttons>
                            </ext:FormPanel>
                        </Component>
                        <Listeners>
                            <Expand Handler="#{RowEditor1}.record = record; #{RowEditor1}.getForm().loadRecord(record);
                            mostrarImagen(record.get('Imagen'));" />
                        </Listeners>
                    </ext:RowExpander>
                </Plugins>
                <LoadMask Msg="Cargando Datos" ShowMask="true" />
            </ext:GridPanel>
        </Items>
    </ext:Viewport>
    <ext:XScript ID="XScript1" runat="server">

    <script type="text/javascript">
        var mostrarImagen = function(ruta)
        {
            #{imgEstudiante}.setImageUrl('../Images/'+ruta);
        };
    </script>
    </ext:XScript>
    </form>
</body>
</html>
